<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>模块列表</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="模块,列表">
	<meta http-equiv="description" content="This is my page">
	
	<style type="text/css">
	.fm
	{
		border-width:1px;
		border-style:solid;
		border-color:lightblue;
		background-color:#e6f3ff;
		width:200px;
		height:25px;
		margin:2px 0px 0px 0px;
		float:center;
		display:block-inline;
	}
	
	.module
	{
		color:blue;
		font-weight:bold;
		font-size:14px;
		letter-spacing:3px;
	}
	</style>
	
  </head>
  
  <body>
    <center>
    	<s:form name="frm" id="frm" method="post" action="" namespace="">
    		<s:iterator value="fmList" status="s">
				<div id="fmDiv<s:property value='id'/>" align="left" class="fm">
					<table cellpadding="0" cellspacing="0" width="100%">
						<tr>
							<td align="left" width="30px">
								<input type="checkbox" name="fmIds" value="<s:property value='id'/>" />
							</td>
							<td align="left">
								<font class="module">
								<a href="javascript:showFlow('<s:property value="id"/>')">
									<s:property value="moduleName"/>
								</a>
								</font>
							</td>
							<td align="center" width="60px">
								<a href="javascript:toUpdateFlowModule('<s:property value="id"/>')">修改</a>
							</td>
						</tr>
					</table>
				</div>
			</s:iterator>
			<br>
			<input type="button" value="新增" class="btn" onclick="toAddFlowModule()"/>
			&nbsp;
			<input type="button" value="删除" class="btn" onclick="delFlowModule()"/>
    	</s:form>
    </center>
    
    <script type="text/javascript">
    var beforeFmId = 0;
    
    function showFlow(id)
    {
    	var url = realPath + '/inner/flow/flowList.action?fmvo.fm.id=' + id;
    	var mainFrame = parent.$('#mainFrame');
    	mainFrame.attr('src', url);
    	
    	fillColor(id);
    }
    
    function toAddFlowModule()
    {
    	var url = realPath + '/inner/flow/toAddModule.action';
    	showMd(url, 350, 200);
    }

    function toUpdateFlowModule(id)
    {
    	var url = realPath + '/inner/flow/toUpdateModule.action?fm.id=' + id;
    	showMd(url, 350, 200);
    }

    function delFlowModule()
    {
    	var fmIds = $('input[name=fmIds][checked]');
    	if(fmIds.length == 0)
    	{
    		showMsg('请选择要删除的模块。');
    		return;
    	}
    	showConfirm('确认删除？', function(v){
    		if(v == true)
    		{
    			var url = 'inner/flow/delModule.action';
		    	ajaxAction(url, 'post', 'frm', true, function(msg){
		   			showMsg('删除成功。' + msg, function(){
		   				window.location.href = window.location.href;
		   			});
		    	});
    		}
    	});
    }
    
    function fillColor(id)
    {
    	if(0 != beforeFmId)
    	{
    		var fmDivB = $('#fmDiv' + beforeFmId);
    		fmDivB.css('background-color', '#e6f3ff');
    	}
    	var fmDivA = $('#fmDiv' + id);
    	fmDivA.css('background-color', '#FFFFCC');
    	beforeFmId = id;
    }
    </script>
  </body>
</html>
